#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <algorithm>
using namespace std;

const int N = 1e5 + 10;
int n;
long long arr[N];

int main()
{
    cin >> n;
    for (int i = 0; i < n; i++)    cin >> arr[i];

    int i = 0, ret = 0;
    while (i < n)
    {
        if (i == n - 1)
        {
            ret++;
            break;
        }
        if (arr[i] > arr[i + 1])
        {
            while (i + 1 < n && arr[i] >= arr[i + 1])
                i++;
            ret++;
        }
        else if (arr[i] < arr[i + 1])
        {
            while (i + 1 < n && arr[i] <= arr[i + 1])
                i++;
            ret++;
        }
        else
        {
            while (i + 1 < n && arr[i] == arr[i + 1])
                i++;
        }
        i++;
    }
    cout << ret << endl;
    return 0;
}